package com.scy.edu;

import com.scy.edu.serviceImpl.UserServiceImpl;
import org.I0Itec.zkclient.ZkClient;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * @author 司晨雨
 * @date 2020/8/20 22:35
 * @description
 */
@SpringBootApplication()
public class ServerBoot {

    public static void main(String[] args) throws InterruptedException {
        SpringApplication.run(ServerBoot.class, args);
        UserServiceImpl.startServer("127.0.0.1",8888);
        ZkClient zkClient = new ZkClient("127.0.0.1:2181");
        boolean exists = zkClient.exists("/lgServer");
        if(!exists){
            zkClient.createPersistent("/lgServer");
        }
        zkClient.createEphemeral("/lgServer/server1","127.0.0.1:8888");
        System.out.println("创建server1节点成功！");

    }


}
